Skip to content

util/service: Add the generic loopback transport - #498

Merged
chrysh merged 1 commit into
OpenPRoT:ocp-global-demo-wipfrom
9elements:service-loopback
Sep 26, 2026
Merged

chrysh merged 1 commit into
OpenPRoT:ocp-global-demo-wipfrom
9elements:service-loopback

Conversation

@chrysh

@chrysh chrysh commented Sep 25, 2026 •

Copy link
Copy Markdown
Contributor

i2c and pldm each wrote their own loopback, both the same shape around a
different dispatch function. Loopback<D, N> is that shape once, over
the Dispatch trait.

The server implementation running behind a kernel channel in production
is the one answering here, so a host test exercises the real encode,
dispatch and decode paths instead of a stand-in.

poll never returns Ok(None) because the response exists the moment
the request does. Delayed<T> wraps any transport and withholds the
response for a set number of polls, which is how a host test reaches
a client's not-ready path without a kernel channel.

From<DispatchError> for TransportError maps dispatch failures into
transport errors with an exhaustive match, so adding a DispatchError
variant is a compile error rather than a silent mislabel.

N sizes the response buffer the async path holds between start and
poll. The blocking path writes into the caller's buffer and does not
use it.

Review the last commit only.

Progress toward 9elements#13.

i2c and pldm each wrote their own loopback, both the same shape around a
different dispatch function. Loopback<D, N> is that shape once, over the
Dispatch trait: the server implementation that runs behind a kernel
channel in production answers in-process here, so a host test exercises
the real encode, dispatch and decode paths.

Delayed wraps any transport and withholds the response for a set number
of polls, which is how a host test reaches a client's not-ready path that
a loopback cannot produce.

N sizes the response buffer the async path holds between start and poll.
The blocking path writes into the caller's buffer and does not use it.

Assisted-by: Claude
@chrysh
chrysh marked this pull request as ready for review September 26, 2026 17:36
@chrysh
chrysh merged commit f3f1d7c into OpenPRoT:ocp-global-demo-wip Sep 26, 2026
1 check passed
@chrysh
chrysh deleted the service-loopback branch September 26, 2026 18:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant